package com.mvp.lt.airlineview.panorama;

import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Bundle;

import androidx.annotation.Nullable;

import com.google.vr.sdk.widgets.pano.VrPanoramaEventListener;
import com.google.vr.sdk.widgets.pano.VrPanoramaView;
import com.mvp.lt.airlineview.R;
import com.mvp.lt.airlineview.base.BaseActivity;
import com.mvp.lt.airlineview.map.PolygonLineActivity;
import com.zph.glpanorama.GLPanorama;

/**
 * @author LiuTao
 * @description:
 * @date : 2021/3/10 10:42
 */
public class PanoramaActivity extends BaseActivity {

    public static void show(Context context) {
        Intent intent = new Intent(context, PanoramaActivity.class);

        context.startActivity(intent);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_panorama_show);
        VrPanoramaView mVrPanoramaView = findViewById(R.id.gl_panorama);
        VrPanoramaView.Options paNormalOptions = new VrPanoramaView.Options();
        paNormalOptions.inputType = VrPanoramaView.Options.TYPE_STEREO_OVER_UNDER;
//      mVrPanoramaView.setFullscreenButtonEnabled (false); //隐藏全屏模式按钮
        mVrPanoramaView.setInfoButtonEnabled(false); //设置隐藏最左边信息的按钮
        mVrPanoramaView.setStereoModeButtonEnabled(false); //设置隐藏立体模型的按钮
        mVrPanoramaView.setEventListener(new ActivityEventListener()); //设置监听
        //加载本地的图片源
        mVrPanoramaView.loadImageFromBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.pa_1615254041036), paNormalOptions);
        //设置网络图片源
//        panoWidgetView.loadImageFromByteArray();
    }


    private class ActivityEventListener extends VrPanoramaEventListener {
        @Override
        public void onLoadSuccess() {//图片加载成功
        }


        @Override
        public void onLoadError(String errorMessage) {//图片加载失败
        }

        @Override
        public void onClick() {//当我们点击了VrPanoramaView 时候触发            super.onClick();
        }

        @Override
        public void onDisplayModeChanged(int newDisplayMode) {
            super.onDisplayModeChanged(newDisplayMode);
        }
    }
}
